﻿package com.snzflash.components.slideshow 
{
	import com.snzflash.control.Image;
	import flash.events.Event;
	import flash.events.IOErrorEvent;
	
	/**
	 * Базовый элемент слайдшоу
	 * @author firsoff maxim, tel: +79222345364, skype: maxim.firsoff
	 */
	public class SlideshowItemBase extends Image
	{
		protected var _loaded:Boolean;
		public function SlideshowItemBase() 
		{
			super();
			_useFade = false;
		}
		
		override public function get data():Object { return super.data; };
		
		override public function set data(value:Object):void 
		{
			super.data = value;
			if (!value) return;
			_loaded = true;
			// загрузка изображения
			loadURL(value.url);
			
		};
		
		public function get loaded():Boolean { return _loaded; };
		
		public function set loaded(value:Boolean):void 
		{
			_loaded = value;
		};
		
		override protected function onError(e:IOErrorEvent):void 
		{
			_loaded = false;
			super.onError(e);
		};
		
		override protected function onComplete(event:Event):void 
		{
			_loaded = true;
			super.onComplete(event);
		};
		
	}

}